﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Research.Kinect.Nui;
using Microsoft.Research.Kinect.Audio;
using System.Windows.Media.Media3D;


namespace KiMoCSys.kinectDevice
{
    /// <summary>
    /// It contains the data representing one skeleton's node
    /// </summary>
    class kNode
    {
        private int radius;
        private SkeletonData skeletonNode;

        public kNode(int radius, SkeletonData node)
        {
            this.radius = radius;
            skeletonNode = node;        
        }
        
        public MeshGeometry3D getBuiltSphere()
        {         
            MeshGeometry3D sphere = new MeshGeometry3D();
            Console.WriteLine("\n - skeletonNode X: " +skeletonNode.Position.X);
            Console.WriteLine("\n - skeletonNode Y: " +skeletonNode.Position.Y);
            Console.WriteLine("\n - skeletonNode Z: " +skeletonNode.Position.Z);
            //create a simple cube
            sphere.Positions.Add(new Point3D(skeletonNode.Position.X - radius, skeletonNode.Position.Y - radius, skeletonNode.Position.Z - radius));//-x,-y,-z
            sphere.Positions.Add(new Point3D(skeletonNode.Position.X - radius, skeletonNode.Position.Y - radius, skeletonNode.Position.Z + radius));//-x,-y,+z
            sphere.Positions.Add(new Point3D(skeletonNode.Position.X - radius, skeletonNode.Position.Y + radius, skeletonNode.Position.Z - radius));//-x,+y,-z
            sphere.Positions.Add(new Point3D(skeletonNode.Position.X - radius, skeletonNode.Position.Y + radius, skeletonNode.Position.Z + radius));//-x,+y,-z
            sphere.TriangleIndices.Add(0);
            sphere.TriangleIndices.Add(1);
            sphere.TriangleIndices.Add(2);
            sphere.TriangleIndices.Add(2);
            return sphere;
        }

        public SkeletonData SkeletonNode
        {
            set { skeletonNode = value; }
            get { return skeletonNode; }
        }

        public int Radius
        {
            set { radius = value; }
            get { return radius; }
        }
    }
}
